package com.ustadzmenjawab.util;

import twitter4j.Twitter;
import twitter4j.TwitterException;

public class TwitterUtil {
	public static void checkHitLimit(Twitter restAPI){
		if(restAPI == null)
			return ;
		while(true){
			try {
				if(restAPI.getRateLimitStatus().getRemainingHits() == 0){
					System.out.println("Hit Limit Reached. Sleeping for 2 sec.");
					Thread.sleep(60 * 1000);
				}else{
					return;
				}
			} catch (TwitterException e) {
				e.printStackTrace();
			} catch (InterruptedException e) {
				
				e.printStackTrace();
			}
		}
	}
}
